package com.hzw.saas.common.util.exception;

import org.springframework.http.HttpStatus;

/**
 * 请求太过频繁, 返回HTTP STATUS 429
 *
 * @author zzl
 * @since 09/09/2021
 */
@SuppressWarnings("unchecked")
public class FrequentException extends BaseRuntimeException {

    private static final long serialVersionUID = 1L;

    @Override
    public Integer httpStatus() {
        return HttpStatus.TOO_MANY_REQUESTS.value();
    }

    @Override
    public FrequentException setPrintTrack(boolean printTrack) {
        super.printTrack = printTrack;
        return this;
    }

    @Override
    public FrequentException setPrintMsg(boolean printMsg) {
        super.printMsg = printMsg;
        return this;
    }

    @Override
    public FrequentException setBizCode(String bizCode) {
        super.bizCode = bizCode;
        return this;
    }

    @Override
    public FrequentException setBizMsg(String bizMsg) {
        super.bizMsg = bizMsg;
        return this;
    }

    @Override
    protected void postConstruct() {

    }

    public FrequentException(String msg) {
        super(msg);
    }

    public FrequentException(String msg, Throwable cause) {
        super(msg, cause);
    }
}
